package com.bgs.travelapp.weatherForecast.controller;

import com.bgs.travelapp.result.CommonResult;
import com.bgs.travelapp.weatherForecast.service.WeatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * 查询天气图片 （前端）
 * hbx 2022年8月26日14:41:09
 */
@RestController
@RequestMapping("/weatherForecast")
@CrossOrigin
public class WeatherController {

    @Autowired
    WeatherService weatherService;

    /**
     * 根据天气类型查询天气信息（前端）
     * hbx 2022年8月26日15:01:16
     * @param weatherType
     * @return
     */
    @GetMapping("/getWeatherByWeatherType")
    public CommonResult getWeatherByWeatherType(String weatherType){
        return CommonResult.ok(weatherService.getWeatherByWeatherType(weatherType));
    }

    /**
     * 查询天气所有信息
     * @return
     */
    @GetMapping("getAllWeather")
    public CommonResult getAllWeather(){
        return CommonResult.ok(weatherService.getAllWeather());
    }
}
